<%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=UTF-8"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    request.setAttribute("basePath",basePath);
%>
<!DOCTYPE>
<html>
<head>
    <title>明细信息</title>
    <%@ include file="/resources/js/easyui/taglibs.jsp"%>
    <%@ include file="/resources/js/easyui/_easyui.jsp"%>
    <%@ include file="/resources/js/easyui/_message.jsp"%>
    <%@ include file="/resources/js/easyui/_viewJS.jsp"%>
</head>

<body class="easyui-layout">
    <form name="editform" method="post" id ="editform">
        <table class="tableForm" style="width: 100%;">
            <tr>
                <th align="right" valign="top"><span class="redStart">*</span><label>信息类型：</label></th>
                <td>
                    <label for="rd1" style="width: 45px;margin-left: 5px;">
                        <input type="radio" name="infotype" id="rd1" value="1" style="margin-right: 5px" ${deviceInfo.infotype == 1?"checked":""} />启动
                    </label>
                    <label for="rd2" style="width: 45px;">
                        <input type="radio" name="infotype" id="rd2" value="2" style="margin-right: 5px" ${deviceInfo.infotype == 2?"checked":""} />关闭
                    </label>
                    <label for="rd3" style="width: 45px;">
                        <input type="radio" name="infotype" id="rd3" value="3" style="margin-right: 5px" ${deviceInfo.infotype == 3?"checked":""} />警告
                    </label>
                    <label for="rd4" style="width: 45px;">
                        <input type="radio" name="infotype" id="rd4" value="4" style="margin-right: 5px" ${deviceInfo.infotype == 4?"checked":""} />故障
                    </label>
                </td>
            </tr>

            <tr>
                <th align="right" valign="top"><span class="redStart">*</span><label>信息内容：</label></th>
                <td><input class="easyui-textbox" name="infocontent" value="${deviceInfo.infocontent}" style="width:200px;height:80px" data-options="multiline:true" /></td>
            </tr>

            <tr>
                <th align="right" valign="top"><span class="redStart">*</span><label>发送时间：</label></th>
                <td>
                    <input class="easyui-validatebox" name="sendTime" id="sendTime" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'});" readonly="readonly" style="width:200px" data-options="required:true" />
                </td>
            </tr>

            <tr>
                <th align="right" valign="top"><span class="redStart">*</span><label>收到时间：</label></th>
                <td>
                    <input class="easyui-validatebox" name="receiveTime" id="receiveTime" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'});" readonly="readonly" style="width:200px" data-options="required:true" />
                </td>
            </tr>
        </table>
        <input type="hidden" name="infoid" value="${deviceInfo.infoid}" />
    </form>
<script type="application/javascript">

    function edit(){
        if($("#editform").form('validate')){
            $.ajax({
                url:'${basePath}web/deviceInfo/edit',
                type : 'POST',
                data : $("#editform").serialize(),
                async : false, //默认为true 异步
                traditional:true,
                error: function (response) {
                    ViewHelper.func.ajaxErrorMessage(response);
                },
                success: function (ret) {
                    if(ret.result) {
                        $.messager.alert('提示信息！',ret.info,'info');
                        parent.view.closeEditWin(1);
                        $("#editform").form('clear');
                    }else{
                        $.messager.alert('提示','保存失败!','error');
                    }
                }
            });
        }
    }

    $(function(){
        $("#sendTime").val(formatDateBoxFull('${deviceInfo.occurltime}'));
        $("#receiveTime").val(formatDateBoxFull('${deviceInfo.receivetime}'));
    });

</script>
</body>
</html>
